package com.ruoyi.web.controller.generic;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.generic.domain.*;
import com.ruoyi.generic.service.IGenericService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.ruoyi.common.core.domain.AjaxResult.success;

/**
 * 通用查询部分
 */
@RestController
@RequestMapping("/genericcontroller")
public class GenericController {

    @Autowired
    IGenericService genericService;

    /**
     * 查询组织架构
     * @return
     */
    @PostMapping("/queryOrgs")
    public AjaxResult querylist()
    {
        List<PublicOrg> list = genericService.queryOrgs();
        return success(list);
    }

    /**
     * 查询应用系统
     * @return
     */
    @PostMapping("/queryAppSystems")
    public AjaxResult queryAppSystems()
    {
        List<PublicAppsystem> list = genericService.queryAppSystem();
        return success(list);
    }

    /**
     * 查询数据库
     * @return
     */
    @PostMapping("/queryDataBases")
    public AjaxResult queryDataBases()
    {
        List<PublicDatabase> list = genericService.queryDataBases();
        return success(list);
    }

    /**
     * 查询实例
     * @return
     */
    @PostMapping("/queryExamples")
    public AjaxResult queryExamples()
    {
        List<PublicExample> list = genericService.queryExamples();
        return success(list);
    }

    /**
     * 查询关注列表
     * @return
     */
    @PostMapping("/queryFollows")
    public AjaxResult queryFollows()
    {
        List<PublicFollow> list = genericService.queryFollows();
        return success(list);
    }

}
